import { Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { SysDictData } from './sys-dict-data.entity';

@Entity('sys_dict')
export class SysDict {
  @PrimaryGeneratedColumn({ type: 'bigint', comment: '主键' })
  id: number;

  @Column({ length: 50, name: 'dict_code', comment: '类型编码' })
  dictCode: string;

  @Column({ length: 50, comment: '类型名称' })
  name: string;

  @Column({ type: 'tinyint', width: 1, default: 0, comment: '状态(0:正常;1:禁用)' })
  status: number;

  @Column({ length: 255, nullable: true, comment: '备注' })
  remark: string;

  @CreateDateColumn({ name: 'create_time', comment: '创建时间' })
  createTime: Date;

  @Column({ name: 'create_by', type: 'bigint', nullable: true, comment: '创建人ID' })
  createBy: number;

  @UpdateDateColumn({ name: 'update_time', comment: '更新时间' })
  updateTime: Date;

  @Column({ name: 'update_by', type: 'bigint', nullable: true, comment: '修改人ID' })
  updateBy: number;

  @Column({ name: 'is_deleted', type: 'tinyint', default: 0, comment: '是否删除(1-删除，0-未删除)' })
  isDeleted: number;

//   // 定义与字典数据表的关联关系
//   @OneToMany(() => SysDictData, dictData => dictData.dict)
//   dictDataList: SysDictData[];
}